home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / text / faqs / object-faq.part1 < prev    next >
Encoding:
Internet Message Format  |  1993-12-15  |  58.6 KB

  1. Subject: Comp.Object FAQ Version 1.0.5 (12-13) Part 1/8
  2. Newsgroups: comp.object,comp.answers,news.answers
  3. From: Bob Hathaway <rjh@geodesic.com>
  4. Date: Tue, 14 Dec 1993 04:39:20 GMT
  5.  
  6. Archive-name: object-faq/part1
  7. Last-Modified: 12/13/93
  8. Version: 1.0.5
  9.  
  10. COMP.OBJECT FAQ
  11. Version: 1.0.5
  12. Date:    12/13/1993
  13.  
  14.  
  15. Author:
  16.   Bob Hathaway
  17.   Geodesic Systems
  18.   rjh@geodesic.com
  19.  
  20.  
  21. Anonymous FTP Sites and Hypertext Server:
  22.   anonymous@zaphod.uchicago.edu:/pub/comp.object-faq.1.0.5(.Z) (128.135.72.61)
  23.   anonymous@rtfm.mit.edu:/pub/usenet/comp.object/*_Part_*
  24.   http://cui_www.unige.ch/OSG/FAQ/OO-FAQ/index.html
  25.  
  26. Mail Server:  (See also section 1.24)
  27.   mail mail-server@rtfm.mit.edu
  28.   Subject:
  29.   send usenet/comp.object/*
  30.  
  31. Zaphod is preferred over rtfm for anonymous ftp retrieval, as it provides a
  32. single file.  Rtfm contains the FAQ as posted.
  33.  
  34. To use the hypertext system, see APPENDIX E, entries 27.
  35. There is currently no comp.object archive.
  36.  
  37.  
  38. Copyright 1992-1994  Bob Hathaway
  39. All rights reserved.
  40.  
  41. Permission is granted to freely copy and distribute this document but only at
  42. no cost to others and with the exception of a nominal distribution fee, if
  43. any.  No sale, resale or reprinting is granted without the explicit written
  44. permission of the author.
  45.  
  46. Contributors:  Per Abrahamsen, Stewart Clamen, Edwardo Casais, Dennis De
  47.   Champeaux, Mike DeVaney, Eric Dujardin, Piercarlo Grandi, Brian Henderson-
  48.   Sellers, Urs Hoelzle, Paul Johnson, Bill Kinnersley, James Odell, Eoin Woods
  49.   and many others whose contributions have helped this document to fulfull its
  50.   objective of bringing object-oriented concepts and systems to everyone.
  51.  
  52. Objective:
  53.   In the spirit of other FAQs, to provide a simple document to answer the most
  54.   frequently asked and recurring questions and to allow new users to understand
  55.   frequently discussed topics and terms used in comp.object.   This should
  56.   bring new comp.object readers and/or writers to at least an introductory
  57.   level of comprehension as soon as possible.  Other goals (hopes) are to
  58.   provide a quick and current reference on available systems such as object-
  59.   oriented languages, CASE, OODB and etc. and to provide good references to
  60.   current and relevant OO systems, groups, texts and literature.
  61.  
  62. Disclaimer:
  63.   This document does not necessarily reflect the opinions of the author's or
  64.   any contributor's companies.  There are no explicit or implicit guarantees
  65.   implied by this document.
  66.  
  67. While object systems are a constantly changing and moving target with a broad
  68. diversity of often conflicting methodologies, constructs, terminologies,
  69. approaches, languages, implementations and etc. and comp.object has a wide
  70. diversity of readers and writers ranging from students, professors and
  71. researchers in academia to beginners, professionals, top-notch experts and
  72. leaders in industry with a broad range of experience and backgrounds ranging
  73. across many paradigms, this FAQ can certainly not aspire to satisfy all of them
  74. completely but instead attempts to provide the most well-rounded treatment of
  75. object-oriented concepts and realizations primarily from the mainstream and
  76. popular authors and systems and further to provide a collection of available
  77. systems and tools in the appendices.
  78.  
  79. It should be understood that it is not possible to present a complete,
  80. unbiased, and perfect document on the subject to be everything to all
  81. people; however, herein lies at least one effort to provide a reasonable
  82. compromise.
  83.  
  84. Several improvements are planned for future FAQs, including a glossary.
  85.  
  86.  
  87. SECTION 1:  BASICS
  88.   1.1)  What Is An Object?
  89.   1.2)  What Is Object Encapsulation (Or Protection)?
  90.   1.3)  What Is A Class?
  91.   1.4)  What Is A Meta-Class?
  92.   1.5)  What Is The Infinite Regress Of Objects And Classes?
  93.   1.6)  What are MOPs and Reflection?
  94.   1.7)  What Is Inheritance?
  95.   1.8)  What Is Multiple Inheritance?
  96.   1.9)  Does Multiple Inheritance Pose Any Additional Difficulties?
  97.   1.10) What Is Dynamic Inheritance?
  98.   1.11) What Is Shared (Repeated) Inheritance?
  99.   1.12) Why Use Inheritance?
  100.   1.13) Why Don't Some People Like Inheritance?
  101.   1.14) What Is Specialization/Generalization/Overriding?
  102.   1.15) What Is The Difference Between Object-Based And Object-Oriented?
  103.   1.16) Is A Class An Object?
  104.   1.17) Is An Object A Class?
  105.   1.18) What Is A Method? (And Receiver And Message)
  106.   1.19) What Are Multi-Methods And Multiple-Polymorphism?
  107.   1.20) What Is OOP?
  108.   1.21) What Is OOA/OOD (And Where Can I Get What I Need On It)?
  109.   1.22) Where Did Object-Orientation Come From?
  110.   1.23) What Are The Benefits Of Object-Orientation?
  111.   1.24) What Other FAQs Are available?
  112.  
  113. SECTION 2:  TYPING
  114.   2.1)  What Is Polymorphism?
  115.   2.2)  What Does Polymorphism Boil Down To In OO Programming Languages?
  116.   2.3)  What Is Dynamic Binding?
  117.   2.4)  Is There A Difference Between Being A Member Or Instance Of A Class?
  118.   2.5)  What Is This I Read About ML And Functional Programming Languages?
  119.   2.6)  What Is the Difference Between Static And Dynamic Typing?
  120.   2.7)  What Is A Separation Between Type And Class (Representation)?
  121.   2.8)  What Are Generics And Templates?
  122.  
  123. SECTION 3:  GENERAL
  124.   3.1)  What Is The "Classical" Object-Oriented Paradigm?
  125.   3.2)  What Is The "Delegation/Prototyping" Object-Oriented Paradigm?
  126.   3.3)  Are There Any Other Object-Oriented Paradigms?
  127.   3.4)  What Are The Major Object-Oriented Programming Languages Today?
  128.   3.5)  What Are Object-Oriented Databases And Persistence?
  129.   3.6)  What Are Object-Oriented Operating Systems?
  130.   3.7)  What Are The Current Object-Oriented Methodologies?
  131.   3.8)  What Is The OMG/OMA/ORB/CORBA?
  132.   3.9)  Why Is Garbage Collection A Good Thing?
  133.   3.10) What Can I Do To Teach OO To The Kids?
  134.   3.11) What Is Available On Object-Oriented Testing?
  135.   3.12) What Distributed Systems Are Available?
  136.   3.13) What Is The MVC Framework?
  137.   3.14) What is Real-Time?
  138.  
  139. SECTION 4:  COMMONLY ASKED LANGUAGE SPECIFIC QUESTIONS
  140.   4.1)  What Is Downcasting?
  141.   4.2)  What Are Virtual Functions?
  142.   4.3)  Can I Use Multiple-Polymorphism Or Multi-Methods In C++?
  143.   4.4)  Can I Use Dynamic Inheritance In C++?
  144.  
  145. ANNOTATED BIBLIOGRAPHY
  146.  
  147. APPENDIXES
  148.   APPENDIX A  VIPS
  149.   APPENDIX B  OBJECT-ORIENTED DATABASES AND VENDORS
  150.   APPENDIX C  OBJECT-ORIENTED LANGUAGES AND VENDORS
  151.   APPENDIX D  OBJECT-ORIENTED CASE (OOA/D/P TOOLS) AND VENDORS
  152.   APPENDIX E  ANONYMOUS FTP SITES
  153.   APPENDIX F  MAGAZINES, JOURNALS AND NEWSLETTERS
  154.  
  155. [Another appendix on miscellaneous commercial object-oriented systems should
  156.  be added soon for completeness]
  157.  
  158.  
  159. SECTION 1:  BASICS
  160. ==================
  161.  
  162. Suggested Readings:
  163.   [Booch 91, 94]
  164.   Others to be added...
  165.  
  166.  
  167. 1.1) What Is An Object?
  168. -----------------------
  169.  
  170. There are many definitions of an object, such as found in [Booch 91, p77]:
  171. "An object has state, behavior, and identity; the structure and behavior of
  172. similar objects are defined in their common class; the terms instance and
  173. object are interchangeable".  This is a "classical languages" definition, as
  174. defined in [Coplien 92, p280], where "classes play a central role in the
  175. object model", since they do not in prototyping/delegation languages.  
  176. "The term object was first formally applied in the Simula language, and
  177. objects typically existed in Simula programs to simulate some aspect of
  178. reality" [Booch 91, p77].  Other definitions referenced by Booch include
  179. Smith and Tockey: "an object represents an individual, identifiable item,
  180. unit, or entity, either real or abstract, with a well-defined role in the
  181. problem domain." and [Cox 91]: "anything with a crisply defined boundary"
  182. (in context, this is "outside the computer domain".  A more conventional
  183. definition appears on pg 54).  Booch goes on to describe these definitions
  184. in depth.  [Martin 92, p 241] defines: "An "object" is anything to which a
  185. concept applies", and "A concept is an idea or notion we share that applies
  186. to certain objects in our awareness".  [Rumbaugh 91] defines: "We define an
  187. object as a concept, abstraction or thing with crisp boundaries and meaning for
  188. the problem at hand." [Shlaer 88, p 14] defines: "An object is an abstraction
  189. of a set of real-world things such that:
  190.   * all of the real-world things in the set - the instances - have the same
  191.     characteristics
  192.   * all instances are subject to and conform to the same rules"
  193. and on identifying objects: "What are the *things* in this problem?  Most of
  194. the things are likely to fall into the following five categories: Tangible
  195. things, Roles, Incidents, Interactions, and Specifications."  [Booch 91, 4.3]
  196. covers "Identifying Key Abstractions" for objects and classes based on an
  197. understanding of the problem domain and [Jacobson 92] provides a novel approach
  198. to identifying objects through use-cases.
  199.  
  200. The implementation of objects could roughly be categorized into descriptor-
  201. based, capability-based, and simple static-based approaches.  Descriptor-
  202. based approaches (e.g. Smalltalk handles) allow powerful dynamic typing, as
  203. do the capability-based approaches which are typically found in object-
  204. oriented databases and operating systems (object id's).  A "proxy" based
  205. approach with an added layer of indirection to Smalltalk's handles is found
  206. in Distributed Smalltalk which allows transparent, distributed, and migrating
  207. objects [Kim 89, ch 19 and Yaoqing 93].  Simple static approaches are found
  208. in languages such as C++, although the new RTTI facility will supply simple
  209. dynamic typing, which is also present in new versions of Eiffel.
  210.  
  211. Descriptor-based approaches can have pointer semantics and can be statically
  212. typeless (or just "typeless", as in Smalltalk) where references (variables)
  213. have no type, but the objects (values) they point to always do.  An untyped
  214. pointer (such as void* in C++) and an embedded dynamic typing scheme are used
  215. in more conventional languages to fully emulate this style of dynamically typed
  216. programming (see sections 2.3, 4.3, and [Coplien 92]).
  217.  
  218. Below is a simple example to show a most trivial case of OO implementation.
  219. It is primarily intended to introduce new terms.  See [Cardelli 85] for
  220. another semantic definition of OO using functions for methods and for
  221. a view of types as sets of values.
  222.  
  223. Simple statically-typed objects (static and auto vars and temps in C++ and
  224. expanded types in Eiffel) can be viewed as instances of a record type,
  225. whose record fields are called instance variables (Smalltalk) or member data
  226. (C++).  The record (class) may also contain operations which are called
  227. methods (Smalltalk) or member functions (C++) which are equivalent to a
  228. function taking an object of the record type, called the receiver, as the
  229. first parameter.  The receiver is called self (Smalltalk) or this (C++).
  230. Members will denote both instance variables and methods.  Inheritance is
  231. roughly equivalent to a loosely coupled variant record, with derived classes
  232. as variant parts and with multiple-inheritance concatenating several records
  233. to serve as a base.
  234.  
  235. A virtual member in statically typed languages is a base class member that can
  236. be set or respecified by a derived class.  This is roughly equivalent to a
  237. pointer or function pointer in the base class being set by the derived class.
  238. [Stroustrup 90] covers the implementation details of virtual member functions
  239. in C++, which also involve an offset for the receiver to handle multiple-
  240. inheritance.  This is an example of dynamic binding, which replaces a
  241. switch statement on variant parts with a single call, reducing code size
  242. and program complexity (fewer nested programming constructs) and allowing
  243. variants to be added without modifying client code (which causes higher defect
  244. injection rates during maintanance and debugging).
  245.  
  246. Virtual members in dynamically typed languages are more flexible because
  247. static typechecking requirements are dropped.  See section 2.5.
  248.  
  249. The terms method/member function, instance variable/member data, subclass/
  250. derived class, parent class/base class, and etc. will be used interchangeably.
  251. As pointed out in [Stroustrup 90, p197], the base/derived class terminology
  252. may be preferable to the sub/super-class terminology, and is preferred in
  253. this document also.
  254.  
  255. Delegation/prototyping languages [Kim 89, ch3; Ungar 87, Sciore 89] have a more
  256. flexible kind of object which can play the role of classes in classical OO
  257. languages.  Since there is no separate class construct in these languages, and
  258. only objects, they are referred to as single-hierarchy, or 1 Level systems.
  259. Objects contain fields, methods and delegates (pseudo parents), whereas
  260. classical object-oriented languages associate method, field and parent
  261. definitions with classes (and only associate state and class with objects,
  262. although vtables of function pointers for dynamic binding is an exception).
  263. However, one-level objects often play the role of classes to take advantage of
  264. sharing and often instances will simply delegate to parents to access methods
  265. or shared state, otherwise idiosyncratic objects, a powerful and natural
  266. concept, will result.  Typical 1 Level objects can contain any number of
  267. fields, methods and parents and any object can be used as a template/exemplar,
  268. thus performing the classical role of a class.  In typical prototyping systems,
  269. parents (as any other member) can be added or changed dynamically, providing
  270. dynamic multiple inheritance (or more typically simple delegation).  Here, the
  271. term "Prototype" usually refers to prototype theory, a recent theory of
  272. classification where any object can be inherited from or cloned to serve as a
  273. prototype for newly created instances.  [The Author also uses the term for
  274. languages providing high quality support for rapid prototyping, although this
  275. usage is atypical]  See [Booch 94, pp 154-155] for a brief discussion of
  276. prototype theory in the context of OOA and OOD.
  277.  
  278. It is common in such systems for an object to "become" another kind of object
  279. by changing its parent.  A good example is a window becoming an icon, since
  280. window and icon objects display different behavior (although cognitive
  281. differences are significant too:-)  Delegation refers to delegating the
  282. search for an attribute to a delegate, and is therefore more of a pure
  283. message passing mechanism (as with dynamic scoping) than inheritance, which
  284. also typically specifies non-shared state when used for representation.
  285.  
  286. Chambers has proposed an interesting variation called "Predicate Classes"
  287. [Chambers 93] as a part of his Cecil language.  These classes will only be
  288. parents when certain predicates are true.  This can support a types/classes
  289. as collections of objects view, which is the same as the types as sets of
  290. values view taken by [Cardelli 85].  [Martin 92] provides some examples of
  291. this view applied during OOA.
  292.  
  293. 1 level systems therefore provide the most flexible and powerful capabilities.
  294. Self is a good example of a delegation-based single hierarchy language [Ungar
  295. 87].
  296.  
  297.  
  298. 1.2)  What Is Object Encapsulation (Or Protection)?
  299. ---------------------------------------------------
  300.  
  301. [Booch 91, p. 45] defines: "Encapsulation is the process of hiding all of the
  302. details of an object that do not contribute to its essential characteristics."
  303.  
  304. [Coad 91, 1.1.2] defines: "Encapsulation (Information Hiding).  A principle,
  305. used when developing an overall program structure, that each component of a 
  306. program should encapsulate or hide a single design decision...  The interface
  307. to each module is defined in such a way as to reveal as little as possible
  308. about its inner workings.  [Oxford, 1986]"
  309.  
  310. Some languages permit arbitrary access to objects and allow methods to be
  311. defined outside of a class as in conventional programming.  Simula and
  312. Object Pascal provide no protection for objects, meaning instance variables
  313. may be accessed wherever visible.  CLOS and Ada allow methods to be defined
  314. outside of a class, providing functions and procedures.  While both CLOS
  315. and Ada have packages for encapsulation, CLOS's are optional while Ada's
  316. methodology clearly specifies class-like encapsulation (Adts).
  317.  
  318. However most object-oriented languages provide a well defined interface to
  319. their objects thru classes.  C++ has a very general encapsulation/protection
  320. mechanism with public, private and protected members.  Public members (member
  321. data and member functions) may be accessed from anywhere.  A Stack's Push and
  322. Pop methods will be public.  Private members are only accessible from within
  323. a class.  A Stack's representation, such as a list or array, will usually be
  324. private.  Protected members are accessible from within a class and also from
  325. within subclasses (also called derived classes).  A Stack's representation
  326. could be declared protected allowing subclass access.  C++ also allows a
  327. class to specify friends (other (sub)classes and functions), that can access
  328. all members (its representation).  Eiffel 3.0 allows exporting access to
  329. specific classes.
  330.  
  331. For another example, Smalltalk's class instance variables are not accessible
  332. from outside of their class (they are not only private, but invisible).
  333. Smalltalk's methods are all public (can be invoked from anywhere), but a
  334. private specifier indicates methods should not be used from outside of the
  335. class.  All Smalltalk instance variables can be accessed by subclasses, 
  336. helping with abstract classes and overriding.
  337.  
  338. Another issue is per-object or per-class protection.  Per-class protection
  339. is most common (e.g. Ada, C++, Eiffel), where class methods can access any
  340. object of that class and not just the receiver.  Methods can only access the
  341. receiver in per-object protection.  This supports a subtyping model, as any
  342. object other than the receiver is only satisfying an abstract type interface,
  343. whereby no method or object structure can be inferred in the general case.
  344.  
  345.  
  346. 1.3  What Is A Class?
  347. --------------------
  348.  
  349. A class is a general term denoting classification and also has a new meaning
  350. in object-oriented methods.  Within the OO context, a class is a specification
  351. of structure (instance variables), behavior (methods), and inheritance
  352. (parents, or recursive structure and behavior) for objects.  As pointed out
  353. above, classes can also specify access permissions for clients and derived
  354. classes, visibility and member lookup resolution.  This is a feature-based or
  355. intensional definition, emphasizing a class as a descriptor/constructor of
  356. objects (as opposed to a collection of objects, as with the more classical
  357. extensional view, which may begin the analysis process).
  358.  
  359. Original Aristotlean classification defines a "class" as a generalization of
  360. objects:
  361. [Booch 91, p93]
  362.   "a group, set, or kind marked by common attributes or a common attribute; a
  363.    group division, distinction, or rating based on quality, degree of
  364.    competence, or condition".
  365.    
  366. [Booch's definition in the context of OOD]
  367.   "A class is a set of objects that share a common structure and a common
  368.   behavior."  "A single object is simply an instance of a class."
  369.  
  370. The intension of a class is its semantics and its extension is its instances
  371. [Martin 92].
  372.  
  373. [Booch 94, 4.2] proposes 3 views of classification as useful in OO analysis and
  374. design: classical categorization (common properties), conceptual clustering
  375. (conceptual descriptions), and prototype theory (resemblance to an exemplar).
  376. He advocates starting with the former approach, turning to the second approach
  377. upon unsatisfactory results, and finally the latter if the first two approaches
  378. fail to suffice.
  379.  
  380.  
  381. 1.4)  What Is A Meta-Class?
  382. ---------------------------
  383.  
  384. [See also section 1.6]
  385.  
  386. A Meta-Class is a class' class.  If a class is an object, then that object
  387. must have a class (in classical OO anyway).  Compilers provide an easy way to
  388. picture Meta-Classes.  Classes must be implemented in some way; perhaps with
  389. dictionaries for methods, instances, and parents and methods to perform all
  390. the work of being a class.  This can be declared in a class named "Meta-Class".
  391. The Meta-Class can also provide services to application programs, such as
  392. returning a set of all methods, instances or parents for review (or even
  393. modification).  [Booch 91, p 119] provides another example in Smalltalk with
  394. timers.  In Smalltalk, the situation is more complex.  To make this easy, refer
  395. to the following listing, which is based on the number of levels of distinct
  396. instantiations:
  397.  
  398. 1 Level System
  399.   All objects can be viewed as classes and all classes can be viewed as
  400.   objects (as in Self).  There is no need for Meta-Classes because objects
  401.   describe themselves.  Also called "single-hierarchy" systems.
  402.   There is only 1 kind of object.
  403. 2 Level System
  404.   All Objects are instances of a Class but Classes are not accessible to
  405.   programs (no Meta-Class except for in the compiler and perhaps for type-safe
  406.   linkage, as in C++).
  407.   There are 2 kinds of distinct objects: objects and classes.
  408. 3 Level System
  409.   All objects are instances of a class and all classes are instances of
  410.   Meta-Class.  The Meta-Class is a class and is therefore an instance of
  411.   itself (really making this a 3 1/2 Level System).  This allows classes to
  412.   be first class objects and therefore classes are available to programs.
  413.   There are 2 kinds of distinct objects (objects and classes), with a
  414.   distinguished class, the metaclass.
  415. 5 Level System
  416.   What Smalltalk provides.  Like a 3 Level System, but there is an extra level
  417.   of specialized Meta-Classes for classes.  There is still a Meta-Class as in 
  418.   a 3 Level System, but as a class it also has a specialized Meta-Class, the
  419.   "Meta-Class class" and this results in a 5 Level System: 
  420.     object
  421.     class
  422.     class class (Smalltalk's Meta-Classes)
  423.     Meta-Class
  424.     Meta-Class class
  425.  
  426.   The "class class"es handle messages to classes, such as constructors and
  427.   "new", and also "class variables" (a term from Smalltalk), which are
  428.   variables shared between all instances of a class (static member data in
  429.   C++).  There are 3 distinct kinds of objects (objects, classes, and
  430.   metaclasses).
  431.  
  432.  
  433. 1.5)  What Is The Infinite Regress Of Objects And Classes?
  434. ----------------------------------------------------------
  435.  
  436. In the authors opinion, a myth.  The story goes an object is an instance of a
  437. class (Meta-Object), a class is an instance of a Meta-Class, which must also
  438. be an instance of a Meta-Meta-Class, which must also be an instance of a Meta-
  439. Meta-Meta-Class, ...  Closure can be achieved with an instance-of loop, as with
  440. a Meta-Class being an instance of itself or with a "Meta-Class - Meta-Class
  441. class" instance-of loop (as in Smalltalk).
  442.  
  443.  
  444. 1.6)  What Are MOPs And Reflection?
  445. -----------------------------------
  446.  
  447. MOP is an acronym for Meta-Object Protocol.  This is a system with
  448. Meta-Classes accessible to users [Kiczales 92].  In CLOS terminology, an
  449. introspective protocol provides a read only capability (e.g. what is this
  450. object's class, give info on this class, etc.) and an intercessory protocol
  451. provides a write capability which allows system modification (e.g. add the
  452. following method or instance to this class, perform inheritance this way,
  453. etc.).  Because inheritance can be used to perform differential changes,
  454. intercessory protocols allow users to not only define new frameworks but
  455. to specialize existing system frameworks differentially without affecting
  456. them and their extant objects.  Thus, many frameworks can interoperate
  457. together simultaneously.  This is a good example of object-oriented reuse,
  458. since the compiler itself is reused thru specialization to provide new
  459. frameworks.
  460.  
  461. "Reflective" systems are systems with MOPs (not to be confused with reflexive
  462. systems, which often refer to systems implemented in terms of themselves, or
  463. bootstrapped).  Reflective systems are inevitably reflexive (as are most
  464. quality compilers), providing a direct program interface to the system.
  465.  
  466.  
  467. 1.7)  What Is Inheritance?
  468. --------------------------
  469.  
  470. Inheritance provides a natural classification for kinds of objects and allows
  471. for the commonality of objects to be explicitly taken advantage of in modeling
  472. and constructing object systems.  See the example below using computers.
  473.  
  474. Inheritance is a relationship between classes where one class is the parent
  475. (base/superclass/ancestor/etc.) class of another.  Inheritance provides
  476. programming by extension (as opposed to programming by reinvention
  477. [LaLonde 90]) and can be used as an is-a-kind-of (or is-a) relationship or
  478. for differential programming.  Inheritance can also double for assignment
  479. compatibility (see section 2.7).
  480.  
  481. In delegation languages, such as Self, inheritance is delegation where objects
  482. refer to other objects to respond to messages (environment) and do not
  483. respecify state by default.
  484.  
  485. Inherited parents can specify various flavors of state.  Delegation languages
  486. don't specify new state by default (to do so requires cloning), C-based (C++,
  487. Eiffel, Objective-C, etc.), lisp-based (CLOS, Flavors, Scheme, etc.), and
  488. Pascal-based (Ada-9x, Modula-3, Object Pascal, etc.) OO languages do, but with
  489. multiple-inheritance can also share parents within a class lattice (CLOS and
  490. Eiffel provide this as a default at the level of slots and features,
  491. respectively).
  492.  
  493. Inheritance also provides for member lookup, or internal environment.  Various
  494. schemes exist, for example C++ finds the closest match within a scope but
  495. causes an ambiguity error iff more than one parent has match, CLOS creates
  496. a linear precedence list, Self provides parent priorities, and Eiffel forces
  497. renaming for any parent member conflicts.
  498.  
  499. Defining inheritance (with a thorough description or denotational semantic
  500. definition, or both) can avoid confusion about which inheritance scheme is
  501. being used (especially in OOD), because inheritance has many variations and
  502. combinations of state and environment (sometimes with complex rules).
  503. Inheritance can also be used for typing, where a type or class can be used to
  504. specify required attributes of a matching object (see sections 2.1, 2.7 and
  505. [Cardelli 85]).  It would be more judicious to have discussions on how
  506. inheritance should be defined instead of over what it is, since it has many
  507. existing uses and semantics.
  508.  
  509. An example of the is-a-kind-of relationship is shown below.  Is-a is often
  510. used synonymously, but can be used to show the "object is-a class"
  511. instantiation relationship.  In classical OO, inheritance is a relationship
  512. between classes only.  In one-level systems, is-a (object instantiation) and
  513. is-a-kind-of (inheritance) are merged into one [Ungar 87, Madsen 93, Sciore
  514. 89].
  515.  
  516.                                Computer
  517.                               /    |     \
  518.                        Mainframe  Mini    Personal
  519.                         /    \    ...       /   \
  520.                   Data Proc  Scientific   PC    Workstation
  521.  
  522. Class hierarchies are subjective [Booch 91, 4.2; Lakoff 87] and usually drawn
  523. with the parent class on top, but more demanding graphs (as is often the case
  524. in [Rumbaugh 91]) allow any topology, with the head of an arrow indicating the
  525. base class and the tail indicating the derived class.
  526.  
  527. Differential programming is the use of inheritance to reuse existing classes
  528. by making a small change to a class.  Creating a subclass to alter a method
  529. or to add a method to a parent class is an example.
  530.  
  531.  
  532. 1.8)  What Is Multiple Inheritance?
  533. -----------------------------------
  534.  
  535. Multiple Inheritance occurs when a class inherits from more than one parent.
  536. For example, a person is a mammal and an intellectual_entity, and a document
  537. may be an editable_item and a kind of literature.
  538.  
  539. Mixin's is a style of MI (from flavors) where a class is created to provide
  540. additional attributes or properties to other classes.  They are intended to be
  541. inherited by any class requiring them.  Method combination, or calling
  542. sequences of before, after, and around methods or even several primary methods
  543. [Kim 89, ch 4], make good use of mixins by invoking their methods without
  544. explicitly calling them, allowing client class code to remain unchanged [Booch
  545. 91, p 113].
  546.  
  547.  
  548. 1.9)  Does Multiple Inheritance Pose Any Additional Difficulties?
  549. -----------------------------------------------------------------
  550.  
  551. Yes, it does.  Any name can be simply resolved to a class member with single
  552. inheritance by simply accessing the first name encountered for data members
  553. and by accessing the first signature match (or ambiguity) encountered for
  554. methods (at least one way, C++ hides some member functions).  Since several
  555. distinct parents can declare a member within a multiple inheritance hierarchy,
  556. which to choose becomes an issue.  Eiffel forces derived classes to rename
  557. parent members that conflict.  Self prioritizes parents.  CLOS merges member
  558. "slots" (instance variables) with the same name into a single slot, as did
  559. the earlier flavors.  C++ declares an error iff a conflict arises, but a
  560. class qualifier can be used to explicitly disambiguate.  Smalltalk renders
  561. same names for instance variables of subclasses illegal.
  562.  
  563. On the other hand, multiple-inheritance can be seen as required for basic
  564. object-oriented programming, because many objects in the real world belong to
  565. several classes.  In classical systems without MI, a class which should inherit
  566. from more than one class must textually include all but one of those classes in
  567. its interface, causing code duplication (and a messy interface).
  568.  
  569.  
  570. 1.10)  What Is Dynamic Inheritance?
  571. -----------------------------------
  572.  
  573. Dynamic inheritance allows objects to change and evolve over time.  Since base
  574. classes provide properties and attributes for objects, changing base classes
  575. changes the properties and attributes of a class.  A previous example was a
  576. window changing into an icon and then back again, which involves changing a
  577. base class between a window and icon class.
  578.  
  579. More specifically, dynamic inheritance refers to the ability to add, delete,
  580. or change parents from objects (or classes) at run-time.  Actors, CLOS, and
  581. Smalltalk provide dynamic inheritance in some form or other.  Single hierarchy
  582. systems, such as Self, provide dynamic inheritance in the form of delegation
  583. [Ungar 87].
  584.  
  585. See also [Kim 89, chs 1, 3] for a discussion and [Coplien 92] for some
  586. implementation discussion in C++.
  587.  
  588.  
  589. 1.11)  What Is Shared (Repeated) Inheritance?
  590. ---------------------------------------------
  591.  
  592. Multiple Inheritance brings up the possibility for a class to appear as a
  593. parent more than once in a class graph (repeated inheritance), and there is
  594. then a potential to share that class.  Only one instance of the class will
  595. then appear in the graph (as is always the case in CLOS, because all *members*
  596. with the same name will be shared (receive a single slot) with the greatest
  597. common subtype as its type).  C++ provides an alternative, where only parents
  598. specified as virtual (virtual bases) are shared within the same class lattice,
  599. allowing both shared and non-shared occurrences of a parent to coexist.  All
  600. "features" in Eiffel (C++ members) of a repeated parent that are not to be
  601. shared must be renamed "along an inheritance path", else they are shared by
  602. default.  This allows a finer granularity of control and consistent name
  603. resolution but requires more work for parents with many features.
  604.  
  605.  
  606. 1.12)  Why Use Inheritance?
  607. ---------------------------
  608.  
  609. Inheritance is a natural way to model the world or a domain of discourse,
  610. and so provides a natural model for OOA and OOD (and even OOP).  This is
  611. common in the AI domain, where semantic nets use inheritance to understand
  612. the world by using classes and concepts for generalization and categorization,
  613. by reducing the real-world's inherent complexity.
  614.  
  615. Inheritance also provides for code and structural reuse.  In the above Computer
  616. class diagram, all routines and structure available in class Computer are
  617. available to all subclasses throughout the diagram.  All attributes available
  618. in Personal computers are also available to all of its subclasses.  This kind
  619. of reuse takes advantage of the is-a-kind-of relationship.  Class libraries
  620. also allow reuse between applications, potentially allowing order-of-magnitude
  621. increases in productivity and reductions in defect rates (program errors),
  622. as library classes have already been tested and further use provides further
  623. testing providing even greater reliability.
  624.  
  625. With differential programming, a class does not have to be modified if it is
  626. close to what's required; a derived class can be created to specialize it.
  627. This avoids code redundancy, since code would have to be copied and modified
  628. otherwise.  See [Raj 89] for an alternative approach as found in Jade.
  629.  
  630. Polymorphism is often explicitly available in many OO languages (such as C++,
  631. CLOS, Eiffel, etc.) based on inheritance when type and class are bound together
  632. (typing based on subclassing, or subclass polymorphism), since only an object
  633. which is a member of (inherits from) a class is polymorphically assignment
  634. compatible with (can be used in place of) instances or references of that
  635. class.  Such assignment can result in the loss of an object's dynamic type in
  636. favor of a static type (or even loss of an object's representation to that of
  637. the static class, as in C++ slicing).  Maintaining the dynamic type of objects
  638. can be provided (and preferred); however, C++ provides both sliced and non-
  639. sliced replacement in a statically typed environment (see section 2.1).
  640.  
  641.  
  642. 1.13)  Why Don't Some People Like Inheritance?
  643. ----------------------------------------------
  644.  
  645. Some people complain that inheritance is hierarchical (which is what most
  646. object-oriented languages provide).  They would also like to see more
  647. operations available (set operations are quite common in specialized systems).
  648. The former is a kind of language dependent feature commonly found in object-
  649. oriented languages which are then associated with the term "inheritance"
  650. (although they don't need to be.  For example, delegation languages allow graph
  651. inheritance stuctures).  Some don't like the coupling of classes (as in Jade),
  652. but in the author's opinion many of their complaints are easily answered.  In
  653. systems that provide inheritance, inheritance provides a simple and elegant way
  654. to reuse code and to model the real world in a meaningful way.
  655.  
  656. Others complain multiple inheritance is too complicated because it brings up
  657. the issues of shared bases and member conflict resolution.  But most modern
  658. systems support Multiple Inheritance by employing semantic resolution
  659. strategies or renaming, and most consider MI to be highly desirable.  See the
  660. latter part of section 1.9 for an example of why MI is important.
  661.  
  662. Some prefer association to MI, claiming "roles" (as defined in [Rumbaugh 91])
  663. should be associations and inheritance should be reserved for a single
  664. hierarchy "creation" mechanism, however this loses polymorphism and loses the
  665. use of inheritance for typical classification.  Representation "roles" can be
  666. supported by dynamic multiple inheritance (DMI) in many situations.
  667.  
  668.  
  669. 1.14)  What Is Specialization/Generalization/Overriding?
  670. --------------------------------------------------------
  671.  
  672. To create a subclass is specialization, to factor out common parts of
  673. derived classes into a common base (or parent) is generalization [Booch 91,
  674. p56].  Overriding is the term used in Smalltalk and C++ for redefining a
  675. (virtual in Simula and C++) method in a derived class, thus providing
  676. specialized behavior.  All routines in Smalltalk and Eiffel are overridable
  677. (although in Eiffel they must be "redefined" in a derived class).  Whenever
  678. a method is invoked on an object of the base class, the derived class method
  679. is executed overriding the base class method, if any.  Overriding in Simula
  680. is a combination of overloading and multiple-polymorphism because parameters do
  681. not have to be declared.  Eiffel and Beta are examples of languages allowing
  682. any member to be redefined and not just methods, as is typical.
  683.  
  684.  
  685. 1.15)  What Is The Difference Between Object-Based And Object-Oriented?
  686. -----------------------------------------------------------------------
  687.  
  688. Object-Based Programming usually refers to objects without inheritance
  689. [Cardelli 85] and hence without polymorphism, as in '83 Ada and Modula-2.
  690. These languages support abstract data types (Adts) and not classes, which
  691. provide inheritance and polymorphism.  Ada-9x and Modula-3; however, support
  692. both inheritance and polymorphism and are object-oriented.  [Cardelli 85, p481]
  693. state "that a language is object-oriented if and only if it satisfies the
  694. following requirements:
  695.  
  696.   - It supports objects that are data abstractions with an interface of named
  697.     operations and a hidden local state.
  698.   - Objects have an associated type.
  699.   - Types may inherit attributes from supertypes.
  700.  
  701.   object-oriented = data abstractions + object types + type inheritance
  702.  
  703. These definitions are also found in [Booch 91, Ch2 and Wegner 87].
  704.  
  705. [Coad 91] provides another model:
  706.  
  707.   Object-Oriented = Classes and Objects 
  708.                     + Inheritance 
  709.                     + Communication with messages
  710.  
  711. Stroustrup's first edition of [Stroustrup 91, '86 p. 37] defines object based
  712. as: "... storing type identification in each object, brings us to a style of
  713. programming often referred to as "object based"", which is quite different
  714. from C+W's.
  715.  
  716. A more modern definition of "object-oriented" includes single-hierarchy
  717. languages and perhaps object id's for unique objects.  Object id's support the
  718. modern notion of relocatable, persistent and distributed objects that can
  719. even migrate across machines.  Distributed Smalltalk's proxy objects [Kim 89,
  720. ch 19 and Yaoqing 93] provide another example of a distributable and migratable
  721. object facility.  Separate type system support is another extension.
  722.  
  723. [Booch 94, 2.2] proposes 7 "Elements of the Object Model"; 4 major and 3 minor:
  724.   Major:
  725.     Abstraction
  726.     Encapsulation
  727.     Modularity
  728.     Hierarchy  (Inheritance)
  729.   Minor:
  730.     Typing
  731.     Concurrency
  732.     Persistence
  733.  
  734.  
  735. 1.16)  Is A Class An Object?
  736. ----------------------------
  737.  
  738. In C++ no, because C++ classes are not instances of an accessible class (a
  739. Meta-Class) and because C++ classes are not accessible to programs.  Classes
  740. are objects in 3 Level Systems and above because classes are instances of
  741. meta-classes.  But classes play a dual role, because objects can only be
  742. declared to be instances of a class (and class objects instances of a
  743. meta-class).  In 1 Level (single-hierarchy) systems, all classes are objects.
  744.  
  745.  
  746. 1.17)  Is An Object A Class?
  747. ----------------------------
  748.  
  749. In a Level 3 System and above yes, but only instances of a Meta-Class are
  750. Classes.  Instances of a Class (ordinary objects) are not classes (excluding
  751. hybrid systems).  However, all objects may be classes in single hierarchy
  752. systems, since any object may act as a class (provide object instantiation or
  753. act as a shared parent).
  754.  
  755.  
  756. 1.18)  What Is A Method? (And Receiver And Message)
  757. ---------------------------------------------------
  758.  
  759. A method implements behavior, which is defined by [Booch 91, p80]:
  760.  
  761.   Behavior is how an object acts and reacts, in terms of its state changes
  762.   and message passing.
  763.  
  764. A method is a function or procedure which is defined in a class and typically
  765. can access the internal state of an object of that class to perform some
  766. operation.  It can be thought of as a procedure with the first parameter as
  767. the object to work on.  This object is called the receiver, which is the object
  768. the method operates on.  An exception exists with C++'s static member functions
  769. which do not have a receiver, or "this" pointer.  The following are some common
  770. notations for invoking a method, and this invocation can be called a message
  771. (or message passing, see below):
  772.  
  773.   receiver.message_name(a1, a2, a3)   
  774.   receiver message_name: a1 parm1: a2 parm3: a3
  775.  
  776. Selector would be another good choice for message_name in the above examples,
  777. although keywords (or formal parameter names, like named parameters) are
  778. considered part of the selector in Smalltalk (and hence Objective-C).
  779.  
  780. If done statically, this can be referred to as invocation, and message passing
  781. if done dynamically (true dynamic binding).  Statically typed dynamic binding
  782. (e.g. C++ and Eiffel) is really in between (checked function pointers).
  783.  
  784. See also section 1.19 below for a discussion on the functional (prefix) verses
  785. message based (receiver based) notation.
  786.  
  787.  
  788. 1.19)  What Are Multi-Methods And Multiple-Polymorphism?
  789. --------------------------------------------------------
  790.  
  791. Multi-methods involve two primary concepts, multiple-polymorphism and lack of
  792. encapsulation.  These issues are orthogonal.  Multiple-polymorphism implies
  793. more than one parameter can be used in the selection of a method.  Lack of
  794. encapsulation implies all arguments can be accessed by a multi-method (although
  795. packages can be used to restrict access, as in CLOS).  Multi-methods can also
  796. imply a functional prefix notation, although the CLOS designers (who coined the
  797. term "multi-method") consider the functional and receiver based forms
  798. (messages) equivalent.  Functional syntax was chosen "in order to minimize the
  799. number of new mechanisms added to COMMON LISP" [Kim ch 4, p70 (D. Moon)].
  800. [Chambers 93] discusses multi-methods in his new OO language, Cecil.
  801.  
  802. Multiple-polymorphism allows specialized functions or methods to be defined to
  803. handle various cases:
  804.  
  805.   +(int, int)
  806.   +(int, float)
  807.   +(int, complex)
  808.   +(int, real)
  809.   +(float, complex)
  810.   +(float, real)
  811.   +(float, float)
  812.  
  813. The above functions are specialized to each of the cases required allowing
  814. single, highly cohesive and loosely coupled functions to be defined.  This is
  815. also the true essence of object-oriented polymorphism, which allows objects to
  816. define methods for each specific case desired.  In addition to better coupling
  817. and cohesion, multiple-polymorphism reduces program complexity by avoiding
  818. coding logic (switch statements) and because small methods further reduce
  819. complexity, as code complexity doesn't grow linearly with lines of code per
  820. method, but perhaps exponentially.  This should be distinguished from double
  821. dispatch, a fancy name for single dispatch after a call, which only provides
  822. switching on a single argument per call (but for 2 levels), consistently
  823. ignoring the inherent type of parameters in messaging.  Double dispatch is
  824. used in languages with static typing for efficiency considerations.
  825.  
  826. If all of the above types are Numbers, code can be written without concern for
  827. the actual classes of objects present:
  828.  
  829.   fn(one, two: Number): Number
  830.     return one + two;
  831.  
  832. The addition expression above will invoke the correct "+" function based on the
  833. inherent (true, actual, or dynamic) types of one and two.  Only the inherent
  834. type of "one" would be used with double dispatch!  In the author's opinion,
  835. this is a serious shortcoming.  Further, double dispatch would only allow
  836. switching to the "fn" function based on the type of "one" also.  This could
  837. lead to the use of switch statements based on type or complex coding in many
  838. real-world programming situations, unnecessarily.  In the author's opinion,
  839. this should only be used as necessary, e.g. if the implementation language
  840. doesn't support multiple-polymorphism and either efficiency considerations
  841. dominate and double dispatch can be suffered, or an embedded dynamic typing
  842. scheme is used.
  843.  
  844. Why do multi-methods allow open access to parameters?  It allows for efficient
  845. handling, like C++ friends, usually by allowing representation details of more
  846. than one object to be exposed.  See [Kim ch 4, pp70-71 (D. Moon)] for an
  847. alternative explanation.  While open access can be useful in some cases, it
  848. typically isn't recommended as a general OO practise (see section 1.15, C+W's
  849. requirement 1 for OO languages) and also violates subtype polymorphism, because
  850. only subclass polymorphism is based on representation and not type.
  851.  
  852. Polymorphic languages can be statically typed to provide strong type checking,
  853. efficiency, and to support a static programming idiom, but require restrictions
  854. in many cases, such as requiring overriding methods to have identical
  855. signatures with the methods they substitute (as in C++) or allowing covariant
  856. parameters but limiting base class usage (as in Eiffel).  If these restrictions
  857. are dropped, multiple-polymorphism results.  Thus a single overridable function
  858. declared in a base class may have several functions overriding it in a derived
  859. class differentiated only by their formal argument types.  This therefore
  860. requires both static and dynamic typing, because no formal argument
  861. differentiation is possible without static types, as in Smalltalk, and no
  862. actual argument differentiation is possible without dynamic types (as in C++
  863. and Eiffel).  See section 2.3 for another example of multiple-polymorphism.
  864.  
  865. There is some concern about the efficiency of run-time method selection as
  866. can occur with multiple-polymorphism (or even dynamic message passing).
  867. However, static analysis optimizations are commonly available in the
  868. literature, potentially providing a single static selection in many cases
  869. [See Agrawal 91, Chambers 92, Mugridge 91, and etc.].
  870.  
  871. But coupling the two cases of selector variables (as found in CLOS,
  872. Objective-C, and etc.) and several possible known selectors together with the
  873. general undecidability of dynamic types at compile-time renders dynamic typing
  874. and run-time selection (or checking) as unavoidable in the general case [a
  875. point often mistaken in comp.object.  E.g. simple statically/strongly typed
  876. multi-methods still require dynamic types!]
  877.  
  878. See [Booch 91], multiple-polymorphism, for a good CLOS example.
  879.  
  880.  
  881. 1.20)  What Is OOP?
  882. -------------------
  883.  
  884. OOP stands for Object-Oriented Programming, the usual programming/hacking and
  885. etc. most programmers think of.  Modern software engineering methodologies;
  886. however, consider OOP as the implementation/evolution of an OOD.
  887.  
  888.  
  889. 1.21)  What Is OOA/OOD (And Where Can I Get What I Need On It)?
  890. ---------------------------------------------------------------
  891.  
  892.   See also section 3.7, the Annotated Bibliography, and APPENDIX D.  The
  893.   classified bibliography in [Booch 94] also contains entries on OOA(B), OOD(F)
  894.   and OOP(G).
  895.  
  896. [Booch 91]
  897.   "In OOA, we seek to model the world by identifying the classes and objects
  898.   that form the vocabulary of the problem domain, and in OOD, we invent the
  899.   abstractions and mechanisms that provide the behavior that this model
  900.   requires."
  901.  
  902. [Coad 91]
  903.   "OOA is the challenge of understanding the problem domain, and then the
  904.   system's responsibilities in that light".
  905.   "To us, analysis is the study of a problem domain, leading to a specification
  906.   of externally observable behavior; a complete, consistent, and feasible
  907.   statement of what is needed; a coverage of both functional and quantified
  908.   operational characteristics (e.g. reliability, availability, performance)".
  909.   "Design.  The practise of taking a specification of externally available
  910.   behavior and adding details needed for actual computer system implementation,
  911.   including human interaction, task management, and data management details."
  912.  
  913. And on Domain Analysis:
  914.  
  915.   "Whereas OOA typically focuses upon one specific problem at a time, domain
  916.    analysis seeks to identify the classes and objects that are common to all
  917.    applications within a given domain, [...]".  - [Booch 91]
  918.  
  919.   [The following quotes on domain analysis are from [Berard 93]]
  920.  
  921.   "An investigation of a specific application area that seeks to identify the
  922.    operations, objects, and structures that commonly occur in software systems
  923.    within this area.  - Dan McNicholl
  924.  
  925.   "Systems analysis states what is done for a specific problem in a domain
  926.    while domain analysis states what can be done in a range of problems in a
  927.    domain.  ...A domain analysis is only useful in many similar systems are to
  928.    be built so that the cost of the domain analysis can be amortized over the
  929.    cost of all the systems.
  930.  
  931.    The key to reusable software is captured in domain analysis in that it
  932.    stresses the reusability of analysis and design, not code. - Jim Neighbors
  933.  
  934.   "The process of identifying, collecting, organizing, and representing the
  935.   relevant information in a domain based on the study of existing systems and
  936.   their development histories, knowledge captured from domain experts,
  937.   underlying theory, and emerging technology within the domain."  - Kang et al.
  938.  
  939.   Object-oriented domain analysis (OODA) seeks to identify reusable items
  940.   localized around objects, e.g., classes, instances, systems of interacting
  941.   objects, and kits [frameworks]. OORA analysts and OOD designers will
  942.   interact on a fairly frequent basis with the domain analysis effort.
  943.  
  944.  
  945. OOA and OOD stand for Object-Oriented Analysis and Object-Oriented Design,
  946. respectively.  OOA strives to understand and model, in terms of object-oriented
  947. concepts (objects and classes), a particular problem within a problem domain
  948. (from its requirements, domain and environment) from a user-oriented or domain
  949. expert's perspective and with an emphasis on modeling the real-world (the
  950. system and its context/(user-)environment).  The product, or resultant model,
  951. of OOA specifies a complete system and a complete set of requirements and
  952. external interface of the system to be built.
  953.  
  954. [Shlaer 88] is often credited as the first book on OOA, although their method
  955. adds OO techniques to the traditional structured analysis principles of Yourdon
  956. and Constantine. Their complete approach ([Shlaer 88, 92]) consists of
  957. information modeling and recursive design, or OOA/RD and represents a recent
  958. addition to the structured analysis family (as does Martin and Odell).
  959. [Yourdon 92] provides a critique, although may only refer to their earlier
  960. work.  Many other methodologies including Rumbaugh's OMT, Martin and Odell's
  961. OOA/D, and many others, also share common ground with SA and other existing
  962. analysis methodologies with such constructs as associations (E-R), functional
  963. models, and even DFD's.  Booch, Jacobson, and Wirfs-Brock are examples of OO
  964. methodologies representing a greater departure from the conventional
  965. "structured" techniques, with greater emphasis on objects.  OOram [Reenskaug
  966.  91] provides support and emphasis on types and roles as guiding principles,
  967. which is quite powerful.  [Booch 94] presents a methodology which is an
  968. evolutionary step beyond the first edition by incorporating a collection of the
  969. best features from several of the major OO methodologies, as does HP's new
  970. FUSION methodology.
  971.  
  972. The usual progression is from OOA to OOD to OOP (implementation) and this
  973. Universal Process Model roughly corresponds to the Waterfall Model [Royce 70].
  974. See [Humphrey 89] and [Yourdon 92] for a few of many discussions on software
  975. life-cycle models and their use.  Humphrey also details Worldy and Atomic
  976. Process Models for finer grained analysis and design in the Defined Process
  977. (see below) and discusses other alternatives to the task oriented models.  He
  978. also provides the following critisisms on the Waterfall Model which had led to
  979. Boehm's seminal work on the Spiral Model:
  980.  
  981.   * It does not adequately address changes
  982.   * It assumes a relatively uniform and orderly sequence of development steps
  983.   * It does not provide for such methods as rapid prototyping or advanced
  984.     languages
  985.  
  986. Modern OO methodologies directly address these points and emphasize the
  987. incremental, iterative, evolutionary, concurrent and situational nature of
  988. software development.  [Boehm 86] presents a seminal spiral life-cycle model
  989. with a risk-driven prototyping approach.  [Booch 91, 6.1] proposes a "round-
  990. trip gestalt" design with analyze-design iterations and an overall system
  991. perspective and [Berard 93] proposes an (incremental) "parallel-recursive
  992. design" with analyze-design-implement-test iterations.  [Coad 91b] presents
  993. the following development cycle breakdown:
  994.  
  995.   Waterfall-
  996.     Analysis
  997.     Design
  998.     Programming
  999.  
  1000.   Spiral-
  1001.     Analysis, prototyping, risk management
  1002.     Design, prototyping, risk management
  1003.     Programming, prototyping, risk management
  1004.     [Boehm, 1988]  
  1005.  
  1006.   Incremental-
  1007.     A little analysis
  1008.     A little design
  1009.     A little programming
  1010.     Repeat
  1011.     [Gilb, 1988]
  1012.  
  1013. [Author's note: The spiral model may be incremental in many ways and ends with
  1014.  a waterfall.]
  1015.  
  1016. Since classes and objects are used in all phases of the OO software life-cycle,
  1017. the process is often referred to as seamless, meaning there is no conceptual
  1018. gap between the phases as is often the case in other software development
  1019. methodologies, such as the analysis (DFD's) to design (structure charts) to
  1020. programming gaps found in traditional structured analysis and design.
  1021. Seamlessness together with naturalness is a big advantage for consistency.
  1022.  
  1023. A problem domain has many realizations, or differing OOAs.  An OOA has many
  1024. realizations, or differing OODs, but a similar notation is often used for
  1025. the two.  An OOD also has many realizations, or differing OOPs, but allows a
  1026. selection from among various languages for implementation (choosing the best
  1027. language to implement the design).  But some, such as Bjarne Stroustrup, don't
  1028. like OOA and OOD getting too far from OOP (implementation independent), for
  1029. fear that great discrepancies could occur between OOD and OOP by losing sight
  1030. of the implementation language, which in some cases is predetermined.  See also
  1031. [Stroustrup 91].
  1032.  
  1033. From a greater perspective, the SEI has developed the Software Process Maturity
  1034. Model (SPMM), a 5 level model classifying the progressive levels of an
  1035. organization's software development [Humphrey 89].
  1036.  
  1037.  Level 1: Initial:    Every project is handled differently
  1038.  Level 2: Repeatable: Every project is handled similarly
  1039.  Level 3: Defined:    A standard process is now well defined for all projects
  1040.  Level 4: Managed:    A measurable basis for all improvements to the process
  1041.  Level 5: Optimizing: Emphasis on defect prevention and optimizing/continually
  1042.                       improving the process
  1043.  
  1044. See also [Yourdon 92], [Wilkie 93], and [Booch 94] for discussions on this
  1045. often cited model.  There is also an ISO 9000 standard on software quality.
  1046.  
  1047. Object-Oriented Information Engineering's "Enterprise Modeling" [Martin 92],
  1048. also found in [Jacobson 92], and some recent business "reengineering" efforts
  1049. place information systems within an organizational perspective by modeling
  1050. entire organizations or a large part of them, with the information processing
  1051. system and software products development as integrated components.  [Yourdon
  1052. 92] even calls for "global modeling"!
  1053.  
  1054.  
  1055. 1.22)  Where Did Object-Orientation Come From?
  1056. ----------------------------------------------
  1057.  
  1058. Simula was the first object-oriented language providing objects, classes,
  1059. inheritance, and dynamic typing in 1967 (in addition to its Algol-60 subset).
  1060. It was intended as a conveyance of object-oriented design.  Simula 1 was a
  1061. simulation language, and the later general-purpose language Simula 67 is now
  1062. referred to as simply Simula.  Smalltalk was the next major contributor
  1063. including classes, inheritance, a high-powered graphical environment and a
  1064. powerful dynamic typing mechanism (although these existed to some extent in
  1065. Simula).  Self is somewhat of a Smalltalk-based next generation language, as is
  1066. Beta a followup to Simula (by its original designers).
  1067.  
  1068. [Meyer 88] contains a brief summary and history of Simula and Smalltalk, among
  1069. other OO languages.
  1070.  
  1071.  
  1072. 1.23)  What Are The Benefits Of Object-Orientation?
  1073. ---------------------------------------------------
  1074.  
  1075. Reuse, quality, an emphasis on modeling the real world (or a "stronger
  1076. equivalence" with the RW than other methodologies), a consistent and seamless
  1077. OOA/OOD/OOP package, naturalness (our "object concept") and etc.
  1078.  
  1079. [Harmon 93]:
  1080.   Faster development
  1081.   Increased Quality
  1082.   Easier maintenance
  1083.   Enhanced modifiability
  1084.  
  1085. [Booch 94]:
  1086.   Exploit power of OOPs
  1087.   Reuse of software and designs, frameworks
  1088.   Systems more change resilient, evolvable
  1089.   Reduced development risks for complex systems, integration spread out
  1090.   Appeals to human cognition, naturalness
  1091.  
  1092.  
  1093. 1.24)  What Other FAQs Are Available?
  1094. -------------------------------------
  1095.  
  1096. FAQ's are cross-posted to news.answers and are archived on anonymous ftp from:
  1097.  
  1098.   rtfm.mit.edu:/pub/usenet        (also usenet-by-hierarchy, etc.)
  1099.  
  1100. rtfm archives several FAQs pertinent to OO (most are also archived elsewhere):
  1101.  
  1102.   comp.lang.ada         ajpo.sei.cmu.edu:public/comp-lang-ada/cla-faq[12]
  1103.   comp.lang.c++         sun.soe.clarkson.edu:pub/C++/FAQ [128.153.12.3]
  1104.   comp.lang.clos
  1105.   comp.lang.eiffel      ftp.cm.cf.ac.uk:/pub/eiffel/eiffel-faq
  1106.   comp.lang.oberon
  1107.   comp.lang.objective-c
  1108.   comp.lang.sather      ftp.ICSI.Berkeley.EDU:pub/sather [not on rtfm]
  1109.   comp.lang.scheme      ftp.think.com:/public/think/lisp/scheme-faq.text
  1110.   comp.lang.smalltalk   xcf.Berkeley.EDU:misc/smalltalk/FAQ/SmalltalkFAQ.entire
  1111.   comp.object           zaphod.uchicago.edu:/pub/comp.object-faq.1.0.5(.Z)
  1112.   comp.object.logic     ftp.cs.cmu.edu:*prg_1.faq,prg_2.faq  [128.2.206.173]
  1113.   comp.software-eng
  1114.  
  1115.   [xcf.Berkeley.EDU is 128.32.138.1]
  1116.   * /afs/cs.cmu.edu/project/ai-repository/ai/pubs/faqs/prolog/
  1117.  
  1118. A new C++ libraries FAQ is posted monthly to comp.lang.c++ and should be on
  1119. rtfm soon.  Contact cpplibs@trmphrst.demon.co.uk.  It contains anonymous ftp
  1120. sites and commercial libraries and may be merged with this FAQ soon.
  1121.  
  1122. Many FAQs are also available from mail-servers, however most can be accessed by
  1123. the rtfm mail-server.  Mail to mail-server@rtfm.mit.edu with help and index in
  1124. the body with no leading spaces and on separate lines for more information.
  1125.  
  1126. Example Unix Command (will retrieve this FAQ in about 26 pieces (and growing)):
  1127.   mail mail-server@rtfm.mit.edu
  1128.   Subject:
  1129.   send usenet/comp.object/*
  1130.  
  1131. There is also a great ftp site for sci.virtual-worlds on:
  1132.   stein.u.washington.edu (140.142.56.1)
  1133.           - home of sci.virtual-worlds, huge faq w/ great info!
  1134.           - if unable to use try ftp.u.washington.edu
  1135.           /public/virtual-worlds
  1136.  
  1137. [While vr may not be directly related to comp.object, it is most interesting!
  1138.    - The Author]
  1139.  
  1140.  
  1141. SECTION 2:  TYPING
  1142. ==================
  1143.  
  1144. There are many definitions of type (and class and related concepts).  Many
  1145. authors define the terms as applied by their particular approach or language,
  1146. however we shall proceed in the face of this diversity.
  1147.  
  1148.   References
  1149.     [Blair 89]          Some typing topics.
  1150.     [Booch 91]          Small Section on Typing.
  1151.     [Cardelli 85]       Discussion on Object-Oriented Typing.
  1152.     [Kim 89, ch1]       Discussion on Some Research Topics.
  1153.  
  1154.  
  1155. 2.1)  What Is Polymorphism?
  1156. ---------------------------
  1157.  
  1158. Polymorphism is a ubiquitous concept in object-oriented programming and is
  1159. defined in many ways, so many definitions are presented from: Websters',
  1160. Author, Strachey, Cardelli and Wegner, Booch, Meyer, Stroustrup, and Rumbaugh.
  1161. Polymorphism is often considered the most powerful facility of an OOPL.
  1162.  
  1163. > Webster's New World Dictionary:
  1164.  
  1165. Polymorphism 1. State or condition of being polymorphous.  2. Cryall.
  1166.   crystallization into 2 or more chemically identical but
  1167.   crystallographically distinct forms.  3.  Zool., Bot. existence of an
  1168.   animal or plant in several forms or color varieties.
  1169.  
  1170. polymorphous adj. having, assuming, or passing through many or various forms,
  1171.   stages, or the like.  Also, polymorphic. [<Gk polymorphous multiform]
  1172.  
  1173.  
  1174. > Author's Definition:
  1175.  
  1176. Polymorphism is the ability of an object (or reference) to assume (be replaced
  1177. by) or become many different forms of object.  Inheritance (or delegation)
  1178. specifies slightly different or additional structure or behavior for an object,
  1179. and these more specific or additional attributes of an object of a base class
  1180. (or type) when assuming or becoming an object of a derived class characterizes
  1181. object-oriented polymorphism.  This is a special case of parametric
  1182. polymorphism, which allows an object (or reference) to assume or become any
  1183. object (possibly satisfying some implicit or explicit type constraints
  1184. (parametric type), or a common structure), with this common structure being
  1185. provided by base classes or types (subclass and subtype polymorphism,
  1186. respectively).
  1187.  
  1188.